package com.rede.didiok.pay.web;

import javax.annotation.Resource;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.rede.didiok.common.utils.ResultUtil;
import com.rede.didiok.pay.service.PayOrderService;


/**
 * 支付服务API接口
 */
@RestController
@RequestMapping("/pay/feign/order")
@Api(value = "订单模块", tags = {"订单模块"})
public class PayOrderController {

    @Resource
    private PayOrderService payOrderService;

    /**
     * 查询当前活动的报名人数
     * @return
     */
    @ApiOperation(value = "查询当前活动的报名人数", notes = "查询当前活动的报名人数")
    @PostMapping(value = "/getApplyUserNum")
    public String getApplyUserNumByResourceUid(@RequestParam("resourceUid") String resourceUid) {
        return ResultUtil.successWithData(payOrderService.getApplyUserNumByResourceUid(resourceUid));
    }

    /**
     * 将该活动对应的所有报名订单取消
     * @return
     */
    @PostMapping(value = "/cancelByResourceUid")
    String cancelPayOrderByResourceUid(@RequestParam("resourceUid") String resourceUid){
        return payOrderService.cancelPayOrderByResourceUid(resourceUid);
    }
}
